Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

screwdriver-workflow-parser

Package Overview
Dependencies
Maintainers
0
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

screwdriver-workflow-parser

Parses and converts pipeline configuration into a workflow

  • 4.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-88.14%
Maintainers
0
Weekly downloads
 
Created
Source

Workflow Parser

Version Downloads Build Status Open Issues License

Parses and converts pipeline configuration into a workflow graph

Usage

npm install screwdriver-workflow-parser
const { getWorkflow, getNextJobs, hasCycle } = require('screwdriver-workflow-parser');

// Calculate the directed graph workflow from a pipeline config (and parse legacy workflows)
const workflowGraph = getWorkflow(pipelineConfig, { useLegacy: true });

/* 
{ 
    nodes: [{ name: '~pr'}, { name: '~commit'}, { name: 'main' }], 
    edges: [{ src: '~pr', dest: 'main'}, { src: '~commit', dest: 'main'}] 
}
*/

// Get a list of job names to start as a result of a commit event, e.g. [ 'a', 'b' ]
const commitJobsToTrigger = getNextJobs(workflowGraph, { trigger: '~commit' });

// Get a list of job names to start as a result of a pull-request event, e.g. [ 'PR-123:a' ]
const prJobsToTrigger = getNextJobs(workflowGraph, { trigger: '~pr', prNum: 123 });

// Check to see if a given workflow graph has a loop in it. A -> B -> A
if (hasCycle(workflowGraph)) {
    console.error('Graph contains a loop.');
}

Testing

npm test

License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.

Keywords

FAQs

Package last updated on 06 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc